#!/bin/bash
#using shell script get the value of function

exec 1>forvalue
function func {
        local x1
        local x2
        x1=$(echo "scale=4; (-$2+$d) / (2*$1)" | bc)
        x2=$(echo "scale=4; (-$2-$d) / (2*$1)" | bc)
        echo "$x1,$x2"
}
D=$(echo "scale=4; $2^2 - 4 * $1 * $3" | bc)

if  [ $D -lt 0 ] 
then
    echo "this function is no value"
else 
    d=$(echo "scale=4; sqrt($D)" | bc)
    value=$(func $1 $2 $3 )
    echo $value
fi >&1
